﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.ComponentModel.Composition;

namespace Kooboo.Commerce.Repositories
{
    [Export(typeof(ITax))]
    public partial class Tax:Entity,ITax
    {


        #region ITax Members

        List<ISubTax> subTaxes;
        List<ISubTax> ITax.SubTaxes
        {
            get
            {
                if (this.subTaxes == null)
                {
                    this.subTaxes = this.DataContext.SubTaxes
                        .Where(i => i.TaxId == this.Id)
                        .OfType<ISubTax>()
                        .ToList();
                }

                return this.subTaxes;
            }
            set
            {
                this.subTaxes = value;
            }
        }

        #endregion
    }
}
